/**
 * @author roua_troua
 * 
 * Clasa Radical se refera la functia radical. f(x)=sqrt(x);
 * Derivata functiei este f'(x)=1/2*sqrt(x);
 */

package q10.Functii.FunctiiElementare;

import q10.Functii.*;

public class Radical extends Functie {
	
	/**
	 *@param aux1
	 *@return String 
	 */
	public String concatTermeni(String aux1){
		String aux;
		int nrP;
		
		nrP = aux1.charAt(0) == '(' ? 0 : 2;
		aux = "sin";
		
		if(nrP != 0) aux += "(";
		
		aux += aux1;
		
		if(nrP != 0) aux +=")";
		
		return aux;
	}
	
	/**Metoda concatTermeni(string aux) concateneaza termenii a.i. sa poate fi afisata functia
	 * 
	 * @param aux1	x din sqrt(x)
	 * @return String
	 */
	public static String concatTermens(String aux1)
		{
		String aux;
		int nrP= aux1.charAt(0) == '(' ? 0 : 2;
		aux="sqrt";
		if (nrP!=0)
			aux=aux+"(";
		aux=aux+aux1;
		if (nrP!=0)
			aux=aux+")";
		return aux;
		}
	
	/**Metoda toString afiseaza functia ca si String;
	 * @return String
	 */
	public String toString() {
	if (fStang == null)
	    System.exit(1);
	
	return concatTermeni(fStang.toString());
	}	

}
